//
//  NSDictionary+Mutable.m
//  UtilsDemo
//
//  Created by yunsheng on 15/4/22.
//  Copyright (c) 2015年 yunsheng. All rights reserved.
//

#import "NSDictionary+Mutable.h"

#import "NSArray+Mutable.h"

@implementation NSDictionary (Mutable)

-(NSMutableDictionary *)toMutableDicCascade
{
    NSArray *valueArray = [self allValues];
    NSArray *keyArray = [self allKeys];
    NSMutableDictionary * mDic = [[NSMutableDictionary alloc] init];
    for (int i = 0; i < self.count; i++)
    {
        if ([valueArray[i] isKindOfClass:[NSDictionary class]]) {
            [mDic setObject:keyArray[i] forKey:[valueArray[i] toMutableDicCascade]];
        } else if ([valueArray[i] isKindOfClass:[NSArray class]]) {
            [mDic setObject:keyArray[i] forKey:[valueArray[i] toMutableArrayCascade]];
        } else {
            [mDic setObject:keyArray[i] forKey:valueArray[i]];
        }
    }
    return mDic;
}

@end
